<?php
namespace App\Models;


/**
 * Model ClassMember
 *
 * @property int $id
 * @property int $school_id
 * @property int $campus_id
 * @property int $class_id
 * @property int $student_id
 * @property int $member_type
 * @property int $entry_at
 * @property int $leave_at
 * @property int $status
 * @property string $created_at
 * @property string $updated_at
 * @property string $deleted_at
 *
 * @method static \Illuminate\Database\Query\Builder | \App\Models\ClassMember where($column, $operator = null, $value = null, $boolean = 'and')
 * @method static \Illuminate\Database\Query\Builder | \App\Models\ClassMember whereIn($column, $values, $boolean = 'and', $not = false)
 * @method static \Illuminate\Database\Query\Builder | \App\Models\ClassMember leftJoin($table, $first, $operator = null, $second = null)
 * @method static \Illuminate\Database\Query\Builder | \App\Models\ClassMember rightJoin($table, $first, $operator = null, $second = null)
 * @method static \Illuminate\Database\Query\Builder | \App\Models\ClassMember get($columns = ['*'])
 * @method static \Illuminate\Database\Query\Builder | \App\Models\ClassMember paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null)
 * @method static \Illuminate\Database\Query\Builder | \App\Models\ClassMember find($id, $columns = ['*'])
 * @method static \Illuminate\Database\Query\Builder | \App\Models\ClassMember first($columns = ['*'])
 * @method static \Illuminate\Database\Query\Builder | \App\Models\ClassMember select($columns = ['*'])
 * @method static \Illuminate\Database\Query\Builder | \App\Models\ClassMember orderBy($column, $direction = 'asc')
 * @package App\Model
 */
class ClassMember extends BaseModel
{
    protected $table = 'class_member';

    protected $fillable = ["class_id", 'student_id', 'member_type', 'entry_at', 'leave_at', 'status', 'school_id', 'campus_id'];

    public function student()
    {
        return $this->belongsTo(Student::class);
    }

    public function getStudentNameAttribute()
    {
        return $this->student['student_name'];
    }
}
